package Java编程的逻辑.第八章.泛型.泛型通配符;

import java.util.ArrayList;
import java.util.List;

public class Test {
    static int countLegs(List<? extends Animal> animals) {
        int retVals = 0;
        for(Animal animal : animals) {
            retVals += animal.countLegs();
        }
        return retVals;
    }

    static int countLegs1(List<Animal> animals) {
        int retVals = 0;
        for(Animal animal : animals) {
            retVals += animal.countLegs();
        }
        return retVals;
    }

    public static void main(String[] args) {
        List<Dogs> dogs = new ArrayList<>();
        countLegs(dogs);
    }
}
